Update HintsEditor layout and collapse behavior#5942
Conversation
…apse behavior Signed-off-by: Abhishek-Punhani <punhani.manavabhi@gmail.com>
|
👋 Hi @Abhishek-Punhani, thanks for contributing! For the review process to begin, please verify that the following is satisfied:
Also check that issue requirements are satisfied & you ran Pull requests that don't follow the guidelines will be closed. Reviewer assignment can take up to 2 weeks. |
|
@AlexVelezLl , Could you guide me how can I change the icon color in KButton ? in |
Hey @Abhishek-Punhani! For this, you can use the KButton icon slot instead and set the color to KIcon directly :). You can also use the default slot to place both the button label and the icon if you want more control over the layout.
Yeah, it seems this was an oversight in the designs, but we should keep the assessment toolbar for hints too, so that we can reorder and remove hints. |
@AlexVelezLl, I tried using the KIcon and apply color, color was applied but they are not aligning properly |
|
Yeah, I imagine. We can go with the default slot, then, and see how it goes. Also, many times we need to reset the KIcon relative position like this with this class being applied to this component, because KIcon has a harcoded relative position that sometimes mess up with some layouts. Perhaps this can help? |
…yling Signed-off-by: Abhishek-Punhani <punhani.manavabhi@gmail.com>
|
📢✨ Before we assign a reviewer, we'll turn on |
rtibblesbot
left a comment
There was a problem hiding this comment.
Solid implementation of the collapsible hints section with clean view/edit mode switching. CI passing.
- blocking:
hintViewTextStyleis referenced in the desktop layout but never defined — see inline comment - suggestion: View mode renders raw Markdown string — may be a regression for formatted hints
- suggestion: Collapsible header div is not keyboard-accessible
- praise:
openHintsSectiontest helper makes the new collapse behaviour self-documenting
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
Reviewed the pull request diff checking for:
- Correctness: bugs, edge cases, undocumented behavior, resource leaks, hardcoded values
- Design: unnecessary complexity, naming, readability, comment accuracy, redundant state
- Architecture: duplicated concerns, minimal interfaces, composition over inheritance
- Testing: behavior-based assertions, mocks only at hard boundaries, accurate coverage
- Completeness: missing dependencies, unupdated usages, i18n, accessibility, security
- Principles: DRY (same reason to change), SRP, Rule of Three (no premature abstraction)
- Checked CI status and linked issue acceptance criteria
- For UI changes: inspected screenshots for layout, visual completeness, and consistency
| <div | ||
| v-if="!isHintOpen(hintIdx)" | ||
| class="hint-view-text" | ||
| :style="hintViewTextStyle" |
There was a problem hiding this comment.
blocking: :style="hintViewTextStyle" is bound here but hintViewTextStyle is never defined in computed (only hintPlaceholderStyle and buttonAppearanceOverrides are defined). Vue will warn and no style will be applied. The equivalent div in the touch layout (line 64) has no style binding, so it's unclear what style was intended. Either define the computed property or remove the binding.
| :style="hintViewTextStyle" | ||
| > | ||
| <span :style="isHintEmpty(hint) ? hintPlaceholderStyle : {}"> | ||
| {{ hintDisplayText(hint, hintIdx) }} |
There was a problem hiding this comment.
suggestion: hint.hint is stored as Markdown (TipTapEditor emits via getMarkdown()). Rendering it with {{ }} will show raw Markdown symbols — e.g. a hint containing **bold** will display with the asterisks visible. The previous code used TipTapEditor in view mode which rendered Markdown properly.
If the intent is to show a simplified plain-text preview (matching the design spec's input-like appearance), that's fine — but worth confirming that any existing hints with formatting are acceptable to display as raw Markdown.
There was a problem hiding this comment.
Yeah, we should render the formatted markdown.
There was a problem hiding this comment.
Sounds good, thanks for confirming.
| {{ $tr('noHintsPlaceholder') }} | ||
| <div | ||
| class="hints-header" | ||
| @click="sectionOpen = !sectionOpen" |
There was a problem hiding this comment.
suggestion: The collapsible trigger is a plain div with only a click handler. Keyboard users who navigate with Tab can't focus or activate it. Consider adding tabindex="0", role="button", and a keydown handler (@keydown.enter and @keydown.space) to toggle sectionOpen, or replacing the div with a <button> element.
There was a problem hiding this comment.
I think replacing the div with a button may be the best path forward. Given that this follows the accessible pattern of an accordion, we can follow the same pattern as the StudioAccordion component (i.e., the trigger being a button element, with an aria-controls, aria-expanded, etc).
There was a problem hiding this comment.
That's a great approach — following the StudioAccordion pattern (button element with aria-controls, aria-expanded, etc.) is exactly the right model for an accordion trigger. Thanks for pointing to that reference.
| }; | ||
|
|
||
| const openHintsSection = async user => { | ||
| await user.click(screen.getByText(HintsEditor.$trs.hintsLabel)); |
There was a problem hiding this comment.
praise: Extracting openHintsSection as a named helper is a nice touch — it makes the new UX requirement (section must be opened before interacting with its contents) explicit and self-documenting across all tests.
AlexVelezLl
left a comment
There was a problem hiding this comment.
Just some comments to match the specs!
There was a problem hiding this comment.
Could we add some tests for the toggle flow of the show hints button?
| <VCard | ||
| flat | ||
| :class="hintClasses(hintIdx)" | ||
| <VDivider class="full-width-divider" /> |
There was a problem hiding this comment.
Could we use a plain div with a $themeTokens.fineLine color instead?
| <div> | ||
| <div | ||
| v-if="!hints || !hints.length" | ||
| class="card-border-light pa-3" |
There was a problem hiding this comment.
Now that we are pretty much rewriting this component, could we get rid of the Vuetify things, please? e.g., this car-border-light uses some Vuetify colors, and this pa-3 is a Vuetify class. It would be great if we could start getting rid of some of these.
| data-test="hint" | ||
| @click="onHintClick($event, hintIdx)" | ||
| > | ||
| <VCard |
There was a problem hiding this comment.
Could we achieve this with a plain div, too? Also, could we use the fineLine border color to match the figma specs?
| <!-- Touch device & desktop layout with toolbar above --> | ||
| <template v-if="isTouchDevice || screenSizeLevel <= 3"> | ||
| <VLayout class="mb-2"> | ||
| <VSpacer /> |
There was a problem hiding this comment.
If we can achieve this layout without Vuetify, that'd be great!
| <span :style="isHintEmpty(hint) ? hintPlaceholderStyle : {}"> | ||
| {{ hintDisplayText(hint, hintIdx) }} | ||
| </span> |
There was a problem hiding this comment.
For the placeholder, we should use the color http://design-system.learningequality.org/colors/#palette-grey-v_300
| {{ $tr('noHintsPlaceholder') }} | ||
| </div> | ||
| <div | ||
| v-for="(hint, hintIdx) in hints" |
| .hint-editor-button { | ||
| justify-content: center; | ||
| width: 100%; | ||
| margin-top: 10px; |
There was a problem hiding this comment.
The button on the specs has 11px vertical padding. Could we override the line-height: unset and padding: 11px 16px here to match that? and also a border-radius of 4px
| <template #icon> | ||
| <KIcon | ||
| icon="plus" | ||
| :color="$themePalette.grey.v_700" | ||
| class="add-hint-icon" | ||
| /> | ||
| </template> |
There was a problem hiding this comment.
Seems like the KButton icon container is also adding some relative top value 🫠. Could we use just the default slot of the KButton to render the button label and center the icon with a flex container? And also would be great to add some gap (10px) between the icon and the label.
| <KButton | ||
| :text="$tr('newHintBtnLabel')" | ||
| class="hint-editor-button" | ||
| :style="{ border: `1px dashed ${$themePalette.grey.v_400}` }" |
There was a problem hiding this comment.
Here, the border color should be $themeTokens.fineLine. Also, could we define this border style on the buttonAppearanceOverrides property too?

Updated HintsEditor layout according to new figma specs and added collapse behavior
Summary
Changes:
TipTapEditorin edit mode.References
fixes #5914
Reviewer guidance
AI usage
Used Antigravity for final review and nitpicks.